import style from '@/common/js/style.js';
// #ifdef MP
function toPx(value) {
	const result = /(\d+\.?\d*)(\w+)/.exec(value);
	if ('rpx' === result[2].trim()) {
		return uni.getSystemInfoSync().screenWidth * Number(result[1]) / 750;
	} else if('px' === result[2].trim()) {
		return Number(result[1]);
	} else {
		throw new TypeError(`${value}单位格式不正确`);
	}
	
}

const systemInfo = uni.getSystemInfoSync();
const statusBarHeight = systemInfo.statusBarHeight;
const windowWidth = systemInfo.windowWidth;
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
let navBarHeight = menuButtonInfo.height + 2*(menuButtonInfo.top - statusBarHeight);
let navBarRightOffset = windowWidth - menuButtonInfo.left;
// #endif

const promotion = {
	data() {
		return {
			goTopButton: {
				image: '/static/go-top.png',
				size: `${style.UNI_ICON_SIZE_BASE}`,
				right: `${style.UNI_SPACING_COL_LG}`,
				bottom: `${style.UNI_SPACING_COL_HG}`,
			},
			tpfNavBar: {
				// #ifdef MP
				fixedHeight: `200px`,
				// #endif
				
				backgroundImage: '',
				backgroundColor: '#FFFFFF', 
				left: {
					
					fontFamily: 'tpf-iconfont',
					iconStyle: `margin-left: ${style.UNI_SPACING_COL_BASE};`,
					textStyle: `color: ${style.UNI_TEXT_COLOR_WHITE}`,
					iconList: [
						{
							id: 'back',
							thumb:"",
							text: '',
							textStyle: ``,
						}
					]
				
				},
				center: {
					fontFamily: 'tpf-iconfont',
					iconStyle: `margin-left: ${style.UNI_SPACING_COL_BASE};`,
					textStyle: `color: ${style.UNI_TEXT_COLOR_GREY}
								font-size: ${style.UNI_ICON_SIZE_SM}`,
					iconList: [
						{
							id: 'tpframe',
							fontFamily: '黑体',
							text: '直播'
						}
					]
				
				},
				right: {
				
					fontFamily: 'tpf-iconfont',
					iconStyle: `margin-right: ${style.UNI_SPACING_COL_BASE};
								padding:${style.UNI_SPACING_COL_BASE}
								`,
					textStyle: `margin-bottom: ${style.UNI_SPACING_ROW_SM};
								margin-top: ${style.UNI_SPACING_ROW_SM};
								font-size: ${style.UNI_ICON_SIZE_SM};
								color: ${style.UNI_TEXT_COLOR_GREY}
								`,
					subtitleStyle: `margin-bottom: ${style.UNI_SPACING_ROW_SM};
									color: ${style.UNI_TEXT_COLOR_WHITE}`,
					iconList: [
						{
							id: 'search',
							text: '\ue62c',
						},
					]
				
				}
			},
		}
	},
}

export default promotion;